// SPDX-License-Identifier: Apache-2.0
//
// Copyright © 2017 Trust Wallet.
//
// This is a GENERATED FILE, changes made here MAY BE LOST.
// Generated one-time (codegen/bin/cointests)
//

#include "TestUtilities.h"
#include <TrustWalletCore/TWCoinTypeConfiguration.h>
#include <gtest/gtest.h>


TEST(TW<%= format_name(coin['name']) %>CoinType, TWCoinType) {
    const auto coin = TWCoinType<%= format_name(coin['name']) %>;
    const auto symbol = WRAPS(TWCoinTypeConfigurationGetSymbol(coin));
    const auto id = WRAPS(TWCoinTypeConfigurationGetID(coin));
    const auto name = WRAPS(TWCoinTypeConfigurationGetName(coin));
<% if !coin['chainId'].nil? -%>
    const auto chainId = WRAPS(TWCoinTypeChainId(coin));
<% end -%>
    const auto txId = WRAPS(TWStringCreateWithUTF8Bytes("<%= explorer_sample_tx(coin) %>"));
    const auto txUrl = WRAPS(TWCoinTypeConfigurationGetTransactionURL(coin, txId.get()));
    const auto accId = WRAPS(TWStringCreateWithUTF8Bytes("<%= explorer_sample_account(coin) %>"));
    const auto accUrl = WRAPS(TWCoinTypeConfigurationGetAccountURL(coin, accId.get()));

    assertStringsEqual(id, "<%= coin['id'] %>");
    assertStringsEqual(name, "<%= display_name(coin) %>");
    assertStringsEqual(symbol, "<%= coin['symbol'] %>");
    ASSERT_EQ(TWCoinTypeConfigurationGetDecimals(coin), <%= coin['decimals'] %>);
    ASSERT_EQ(TWCoinTypeBlockchain(coin), TWBlockchain<%= coin['blockchain'] %>);
    ASSERT_EQ(TWCoinTypeP2shPrefix(coin), 0x<%= to_hex(coin['p2shPrefix']) %>);
    ASSERT_EQ(TWCoinTypeStaticPrefix(coin), 0x<%= to_hex(coin['staticPrefix']) %>);
<% if !coin['chainId'].nil? -%>
    assertStringsEqual(chainId, "<%= format_name(coin['chainId']) %>");
<% end -%>
    assertStringsEqual(txUrl, "<%= explorer_tx_url(coin) %><%= explorer_sample_tx(coin) %>");
    assertStringsEqual(accUrl, "<%= explorer_account_url(coin) %><%= explorer_sample_account(coin) %>");
}
